- Courses
- ItemPath API
- Section 2: Formatting Requests
- Date Format
Date Format
The ItemPath API returns dates in YYYY-MM-DDTHH:mm:ss.SSSSSS format. In this example, the Creation Date of a transaction was November 22, 2021, at 7:12 pm, 31 seconds and 91 milliseconds.
"creationDate": "2021-11-22T19:12:31.910000"
To make queries with dates, you can either use any of the formats in the table below, or any of these parameters:
- "now" → current time
- "today" → start of current day
- "yesterday" → start of previous day
- "lastDay" → 24 hours ago
- "lastWeek" → 1 week ago
- "lastMonth" → 1 month ago
- "lastYear" → 1 year ago
For example, if you want to get all transactions since yesterday at 12am, you could use the following call:
/transactions?creationDate=[gt]yesterday
Let's say today's date it March 12, 2024. In that case, "yesterday" represents "2024-03-11T00:00:00.000000", so this API call will get all transactions after that time.
Here are the other acceptable date formats you can use.
Format | Example |
---|---|
YYYY-MM | 2022-01 |
YYYY-MM-DD | 2022-01-23 |
YYYY-MM-DDTHH | 2022-01-23T09 |
YYYY-MM-DDTHH:mm | 2022-01-23T09:07 |
YYYY-MM-DDTHH:mm:ss | 2022-01-23T09:07:21 |
YYYY-MM-DDTHH:mm:ss.S | 2022-01-23T09:07:21.2 |
YYYY-MM-DDTHH:mm:ss.SS | 2022-01-23T09:07:21.20 |
YYYY-MM-DDTHH:mm:ss.SSS | 2022-01-23T09:07:21.205 |
YYYY-MM-DDTHH:mm:ss.SSSS | 2022-01-23T09:07:21.2050 |
YYYY-MM-DDTHH:mm:ss.SSSSS | 2022-01-23T09:07:21.20501 |
YYYY-MM-DDTHH:mm:ss.SSSSSS | 2022-01-23T09:07:21.205010 |
For example, if you want to get all transactions from January 2023, you could filter by after January 1, 2023 and before February 1, 2023. Since no time is specified, it will automatically set the time to 00:00:00.000000.
/transactions?creationDate=[gt]2022-01-01&creationDate=[lt]2022-02-01
Try it with your own date range. How would you get results from the last month?